<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item label="">
            <el-input
              size="medium"
              v-model="subquery"
              placeholder="查询"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              type="primary"
              icon="el-icon-search"
              @click="onSubmit"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              type="primary"
              icon="el-icon-circle-plus-outline"
              @click="newest(1)"
              >新建档案</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="24">
        <div>
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="name" label="姓名" width="">
            </el-table-column>
            <el-table-column prop="date" label="性别" width="">
            </el-table-column>
            <el-table-column prop="date1" label="生日" width="">
            </el-table-column>
            <el-table-column prop="address" label="手机号码"> </el-table-column>
            <el-table-column prop="address1" label="职位"> </el-table-column>
            <el-table-column prop="address2" label="劳动合同">
            </el-table-column>
            <el-table-column prop="address3" label="证书"> </el-table-column>
            <el-table-column prop="address4" label="备注"> </el-table-column>

            <el-table-column label="操作" width="240" align="center">
              <template #default="scope">
                <el-button
                  size="mini"
                  @click="handleEdit(scope.$index, scope.row)"
                  >编辑</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDelete(scope.$index, scope.row)"
                  >删除</el-button
                >
                <el-button size="mini" type="warning">导出</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      :title="single"
      v-model="plassets"
      width="85%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" :inline="true" :model="form" label-width="100px">
        <div class="Basic">基本信息</div>
        <el-form-item label="姓名" style="width: 350px">
          <el-input v-model="form.name" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="邮箱" style="width: 350px">
          <el-input v-model="form.theemail" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="部门" style="width: 350px">
          <el-input v-model="form.department" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="职位" style="width: 350px">
          <el-input v-model="form.position" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" style="width: 350px">
          <el-input v-model="form.phone" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="入职日期" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.dateCount"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="司龄(系统计算)" style="width: 350px">
          <el-input v-model="form.service" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">工作信息</div>
        <el-form-item label="员工类型" style="width: 350px">
          <el-select
            v-model="form.signature"
            clearable
            placeholder="员工类型"
            style="width: 250px"
          >
            <el-option
              v-for="item in typeparam"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="员工状态" style="width: 350px">
          <el-select
            v-model="form.mState"
            clearable
            placeholder="员工状态"
            style="width: 250px"
          >
            <el-option
              v-for="item in driver_state"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="试用期" style="width: 350px">
          <el-input v-model="form.probation" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="实际转正日期" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.positive"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="岗位职级" style="width: 350px">
          <el-input v-model="form.ranktext" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">个人信息</div>
        <el-form-item label="身份证姓名" style="width: 350px">
          <el-input v-model="form.cardinfoname" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="身份证" style="width: 350px">
          <el-input v-model="form.manfid" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="出生日期" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.software"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="年龄" style="width: 350px">
          <el-input v-model="form.ages" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="性别" style="width: 350px">
          <el-radio v-model="form.gender" label="1">男</el-radio>
          <el-radio v-model="form.gender" label="2">女</el-radio>
        </el-form-item>
        <el-form-item label="民族" style="width: 350px">
          <el-input v-model="form.nationale" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="身份证地址" style="width: 350px">
          <el-input v-model="form.address" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="婚姻状况" style="width: 350px">
          <el-select
            v-model="form.marriage"
            clearable
            placeholder="婚姻状况"
            style="width: 250px"
          >
            <el-option
              v-for="item in marriageIndex"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="首次参加工作时间" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.performs"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工龄" style="width: 350px">
          <el-input v-model="form.gServices" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="户籍类型" style="width: 350px">
          <el-select
            v-model="form.household"
            clearable
            placeholder="户籍类型"
            style="width: 250px"
          >
            <el-option
              v-for="item in registration"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="住址" style="width: 350px">
          <el-input
            style="width: 250px"
            v-model="form.bitaddress"
            type="textarea"
            :rows="2"
          ></el-input>
        </el-form-item>
        <el-form-item label="个人社保账号" style="width: 350px">
          <el-input v-model="form.security" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="个人公积金账号" style="width: 350px">
          <el-input v-model="form.accumulation" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">学历信息</div>
        <el-form-item label="学历" style="width: 350px">
          <el-select
            v-model="form.offens"
            clearable
            placeholder="学历"
            style="width: 250px"
          >
            <el-option
              v-for="item in professors"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="毕业院校" style="width: 350px">
          <el-input v-model="form.graduate" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="毕业时间" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.turnedoff"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="所学专业" style="width: 350px">
          <el-input v-model="form.professional" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">银行卡信息</div>
        <el-form-item label="银行卡号" style="width: 350px">
          <el-input v-model="form.banking" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="开户行" style="width: 350px">
          <el-input v-model="form.account" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">合同信息</div>
        <el-form-item label="合同公司" style="width: 350px">
          <el-input v-model="form.contract" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="合同类型" style="width: 350px">
          <el-input v-model="form.contractType" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="首次合同起始日" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.updates"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="首次合同到期日" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.maturity"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="现合同起始日" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.xianupdates"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="现合同到期日" style="width: 350px">
          <el-date-picker
            style="width: 250px"
            v-model="form.xianmaturity"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="合同期限" style="width: 350px">
          <el-input v-model="form.timeLimit" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="续签次数" style="width: 350px">
          <el-input v-model="form.total_owed" style="width: 250px"></el-input>
        </el-form-item>
        <div class="Basic">紧急联系人</div>
        <el-form-item label="紧急联系人姓名" style="width: 350px">
          <el-input v-model="form.contact" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="联系人关系" style="width: 350px">
          <el-select
            style="width: 250px"
            v-model="form.between"
            placeholder="请选择关系"
            clearable
          >
            <el-option
              v-for="item in relationship"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="联系人电话" style="width: 350px">
          <el-input
            v-model="form.contactsphone"
            style="width: 250px"
          ></el-input>
        </el-form-item>
        <el-form-item label="" style="width: 350px"> </el-form-item>
        <el-form-item label="紧急联系人姓名" style="width: 350px">
          <el-input v-model="form.contact1" style="width: 250px"></el-input>
        </el-form-item>
        <el-form-item label="联系人关系" style="width: 350px">
          <el-select
            style="width: 250px"
            v-model="form.between1"
            placeholder="请选择关系"
            clearable
          >
            <el-option
              v-for="item in relationship"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="联系人电话" style="width: 350px">
          <el-input
            v-model="form.contactsphone1"
            style="width: 250px"
          ></el-input>
        </el-form-item>
        <el-form-item label="" style="width: 350px"> </el-form-item>
        <div class="Basic">个人材料</div>
        <el-form-item label="身份证(人像面)" style="width: 350px">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-model="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </el-form-item>
        <el-form-item label="身份证(国徽面)" style="width: 350px">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-model="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </el-form-item>
        <el-form-item label="证书" style="width: 350px">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-model="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </el-form-item>
        <el-form-item label="前公司离职证明" style="width: 350px">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-model="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </el-form-item>
        <el-form-item label="员工照片" style="width: 350px">
          <el-upload
            action="https://jsonplaceholder.typicode.com/posts/"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog v-model="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="" />
          </el-dialog>
        </el-form-item>
      </el-form>
      <template #footer style="text-align: center">
        <span class="dialog-footer">
          <el-button @click="plassets = false">取 消</el-button>
          <el-button type="primary" v-if="under == 1" @click="determine()"
            >确 定</el-button
          >
          <el-button @click="hardware()" v-else type="primary"
            >编辑 确 定</el-button
          >
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      subquery: "",
      dialogImageUrl: "",
      dialogVisible: false,
      fileList: [],
      plassets: false,
      single: "",
      under: 1,
      form: {
        name: "",
        theemail: "", //邮箱
        department: "", //部门
        dateCount: "",
        service: "",
        gender: "1",
        phone: "",
        birthday: "",
        position: "",
        newnotes: "",
        signature: "",
        mState: "",
        probation: "",
        positive: "",
        ranktext: "",
        cardinfoname: "",
        manfid: "",
        software: "",
        ages: "",
        nationale: "", //民族
        address: "",
        performs: "",
        gServices: "",
        household: "",
        bitaddress: "",
        security: "",
        accumulation: "",
        offens: "",
        graduate: "",
        turnedoff: "",
        professional: "",
        banking: "",
        account: "",
        contact: "",
        contact1: "",
        between: "",
        between1: "",
        contactsphone: "",
        contactsphone1: "",
        contract: "",
        contractType: "",
        updates: "",
        maturity: "",
        xianupdates: "",
        xianmaturity: "",
        timeLimit: "",
        total_owed: "",
      },
      relationship: [
        {
          value: "0",
          label: "父母",
        },
        {
          value: "1",
          label: "配偶",
        },
        {
          value: "2",
          label: "子女",
        },
        {
          value: "3",
          label: "其他",
        },
      ],
      professors: [
        {
          value: "0",
          label: "小学",
        },
        {
          value: "1",
          label: "初中",
        },
        {
          value: "2",
          label: "高中",
        },
        {
          value: "3",
          label: "中专",
        },
        {
          value: "4",
          label: "大专",
        },
        {
          value: "5",
          label: "本科",
        },
        {
          value: "6",
          label: "硕士",
        },
        {
          value: "7",
          label: "博士",
        },
        {
          value: "8",
          label: "其他",
        },
      ],
      registration: [],
      marriageIndex: [
        {
          value: "0",
          label: "未婚",
        },
        {
          value: "1",
          label: "已婚",
        },
        {
          value: "2",
          label: "离异",
        },
        {
          value: "3",
          label: "丧偶",
        },
        {
          value: "4",
          label: "分居",
        },
      ],
      typeparam: [
        {
          value: "0",
          label: "全职",
        },
        {
          value: "1",
          label: "兼职",
        },
        {
          value: "2",
          label: "实习",
        },
        {
          value: "3",
          label: "劳务派遣",
        },
        {
          value: "4",
          label: "退休返聘",
        },
        {
          value: "5",
          label: "劳务外包",
        },
        {
          value: "6",
          label: "无类型",
        },
      ],
      driver_state: [
        {
          value: "0",
          label: "试用",
        },
        {
          value: "1",
          label: "正式",
        },
      ],
      tableData: [
        {
          date: "男",
          name: "张三",
          date1: "2021/1/1",
          address: "123123123",
          address1: "职员",
          address2: "....",
          address3: "xxxxx",
          address4: "xxxxxxx",
        },
      ],
    };
  },
  methods: {
    onSubmit() {},
    newest(index) {
      this.under = index;
      this.plassets = true;
      this.single = "新建档案";
    },
    //上传图片
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`
      );
    },
    beforeRemove(file) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    //照片墙
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
  },
};
</script>

<style scoped>
.addccc {
  margin-bottom: 20px;
}
.Basic {
  padding-left: 0px;
  color: #444;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
}
</style>